home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
YERK
/
SUPPLEME
/
MY_STUFF
/
LATE_BIN.D_E
< prev
next >
Wrap
Text File
|
1991-01-01
|
1KB
|
50 lines
\ suppose you have an array with object addresses stored in it:
4 array objectArray
\ make three objects
var myVar
int myInt
rect myRect
string myString
new: myString
myVar myInt myRect myString put: objectArray
\ now put a few values in the objects
12 put: myVar
10 put: myInt
10 10 100 100 put: myRect
" hello" put: myString
\ now draw each object, but late bind to the objects held in the array:
print: [ 0 at: objectArray ]
print: [ 1 at: objectArray ]
print: [ 2 at: objectArray ]
print: [ 3 at: objectArray ]
\ or do it like this
: printStuff limit: objectArray 0 DO print: [ i at: objectArray ] LOOP ;
printStuff
\ suppose myVar points to another object like myRect
myRect put: myVar
print: [ obj: myVar ] \ is the same as
print: [ get: myVar ]
\ note: printstuff will send the print: message to each object in the
\ objectArray. Since myVar now holds an object itself, to print the
\ second object (in this case myRect), one must do this:
\ print: [ obj: [ 0 at: objectArray ] ]